Skip to content

feat: Apache 2.0 license + CI infrastructure + unit tests#1

Merged
colek42 merged 9 commits into
mainfrom
ci-and-license-changes
Feb 4, 2026
Merged

feat: Apache 2.0 license + CI infrastructure + unit tests#1
colek42 merged 9 commits into
mainfrom
ci-and-license-changes

Conversation

@colek42

@colek42 colek42 commented Feb 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Change license from Proprietary to Apache 2.0 - Opens up the project for community contributions
  • Add CI infrastructure following multiclaude patterns for consistent quality gates
  • Add comprehensive unit tests for core policy evaluation and state management

License Change

  • Add Apache 2.0 LICENSE file
  • Update README.md license section
  • Update plugin.json license field

CI Infrastructure

Component Description
GitHub Actions Build, lint, unit tests, integration tests, coverage
golangci-lint gocritic, misspell, errcheck, staticcheck, gofmt
Makefile pre-commit, check-all, coverage targets
Pre-commit hook Runs make pre-commit before commits

Unit Tests

Package Coverage Test Cases
internal/policy 66.1% Tool allow/deny, file access, domain access, limits
internal/state 84.5% State CRUD, metrics tracking, file tracking

Test plan

  • make pre-commit passes
  • make check-all passes
  • All unit tests pass
  • Integration tests pass
  • License file present and correct

🤖 Generated with Claude Code

cole-rgb and others added 9 commits January 18, 2026 21:52
Implement the verify package with:
- VerifySession: validates attestations against policy
- VerifyLatestSession: finds and verifies most recent session
- ListSessions: enumerates available sessions with metadata
- Post-hoc limit checking, attestation verification, data flow checks

Wire up verify and status subcommands in main.go.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implement MCP server (`aflock serve`) that provides:
- get_identity: Derive agent identity from environment
- get_policy: Return loaded .aflock policy
- check_tool: Check if tool call is allowed by policy
- bash: Execute commands with policy enforcement
- read_file/write_file: File operations with policy checks
- get_session: Current session metrics

Also includes:
- Fix glob matching for root-level files (**/*.go now matches main.go)
- Integration test script for CLI hook testing
- Claude Code hooks configuration for test-project

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add LICENSE file with Apache 2.0 license text
- Update README.md license section
- Update plugin.json license field

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
CI Infrastructure (multiclaude patterns):
- Add GitHub Actions CI workflow (build, lint, test, coverage)
- Add golangci-lint configuration with sensible exclusions
- Add Makefile with pre-commit and check-all targets
- Add pre-commit hook script

Unit Tests:
- Add policy evaluator tests (66.1% coverage)
  - Tool allow/deny list evaluation
  - File access patterns (allow, deny, read-only)
  - Domain access controls
  - Require approval patterns
  - Limit checking (fail-fast vs post-hoc)
- Add pattern matcher tests
  - Glob pattern matching
  - Regex pattern matching
  - Tool pattern parsing
- Add session state tests (84.5% coverage)
  - State CRUD operations
  - Metrics tracking
  - File tracking

Code Quality:
- Fix gofmt formatting issues
- Fix errcheck linting issues
- Fix staticcheck receiver name consistency

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add go-witness dependency to go.mod
- Add internal/identity/discover.go for PID-based model discovery
- Update go.sum with new dependencies

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds go-witness attestor integration including the GetGitTreeHash function
required by internal/verify/verifier.go.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Updates verify command to support --policy, --attestations, and --tree-hash flags
- Downgrades Go version from 1.25.0 to 1.23 for CI compatibility
- Fixes golangci-lint version compatibility error

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
go-witness v0.9.2 requires Go >= 1.25.0

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
v2.0.2 was built with Go 1.24 which is lower than our Go 1.25 target

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@colek42 colek42 merged commit b0a8902 into main Feb 4, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants